import {useModel} from 'umi';
import {useEffect} from "react";

export default function HomePage() {
    const masterProps = useModel('@@qiankunStateFromMaster');
    useEffect(() => {
        console.log(masterProps?.globalState, "onGlobalStateChange")
        if (!masterProps?.onGlobalStateChange) return;
        masterProps.onGlobalStateChange(() => {
            console.log(12132123)
        })
    }, [masterProps]);
    return (
        <div>
            <h2>Yay! Welcome to qiankun!</h2>
            <div>我是子应用child1</div>
            <div>我是父应用传过来的值{masterProps?.globalState.slogan}</div>
        </div>
    );
}
